﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//This is the class that interact with the interface
var player = new (function () {
    //Simulate a playlist
    this.playList = ['"Advice is what we ask for when we already know the answer but wish we didn\'t." Erica Mann Jong ',
    '"Only those who will risk going too far can possibly find out how far they can go." T.S. Eliot',
	'"Nothing is impossible, the word itself says \"I\'m possible\"!" Audrey Hepburn ',
    '"Striving for success without hard work is like trying to harvest where you haven\'t planted" David Bly',
	'"There are no secrets to success. It is the result of preparation, hard work, and learning from failure." Colin Powell',
	'"The majority see the obstacles; the few see the objectives; history records the successes of the latter, while oblivion is the reward of the former." Alfred Montapert',
	'"Success is the ability to go from one failure to another with no loss of enthusiasm." Winston Churchill',
	'"Acknowledge that you learn just as much, if not more, from your failures as you do from your successes." Jeffrey Benjamin',
	'"To become successful is to recognize every tiny step towards success ?and then take more of them." Larina Kase'];
    //The song position
    this.position = -1;
    this.nextQuote = function () {
        if (this.position + 1 == this.playList.length)
            this.position = 0;
        else
            this.position++;
        //So, the reference to this class is not lost
        var me = this;
        $(".title").fadeOut(200, function () {
            $(this).text(me.playList[me.position]);
        }).fadeIn();
    }
    //Jump to he previous or last song if it is in the first position
    this.prevQuote = function () {
        if (this.position - 1 < 0)
            this.position = this.playList.length - 1;
        else
            this.position--;

        var me = this;
        $(".title").fadeOut(200, function () {
            $(this).text(me.playList[me.position]);
        }).fadeIn();
    }
});
//Starts playing :P
player.nextQuote();